import { BaseEntity } from '@/modules/core/base/BaseEntity';
import { Column, Entity, JoinColumn, ManyToOne, OneToOne } from 'typeorm';
import { GoodEntity } from './good.entity';
import { BaseCartsEntity } from './baseCarts.entity';
import { OrderEntity } from './order.entity';

@Entity('order_good')
export class OrderGoodEntity extends BaseCartsEntity {
  @ManyToOne((type) => GoodEntity, (goods) => goods.orderGood, {
    onDelete: 'CASCADE',
  })
  good: GoodEntity;

  @ManyToOne((type) => OrderEntity, (order) => order.orderGood, {
    onDelete: 'CASCADE',
  })
  @JoinColumn()
  order: OrderEntity;
}
